/*
* CourseInfoServiceImpl.java
* Created on  2014-5-9 上午11:31
* 版本       修改时间          作者      修改内容
* V1.0.1    2014-5-9       gaoxinyu    初始版本
*
*/
package com.genghis.ptas.scorm.service.impl;

import com.genghis.core.page.entity.Page;
import com.genghis.core.page.entity.PageParameter;
import com.genghis.ptas.scorm.dao.ScormDao;
import com.genghis.ptas.scorm.entity.ScormInfo;
import com.genghis.ptas.scorm.service.CourseInfoService;
import com.genghis.ptas.system.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.genghis.ptas.constant.DictConstant;



/**
 * 类的描述信息
 *
 * @author gaoxinyu
 * @version 1.0.1
 */
@Transactional
@Service("courseInfoService")
public class CourseInfoServiceImpl implements CourseInfoService {

    @Autowired
    private ScormDao scormDao;

    @Autowired
    private  DictService dictService;

    @Override
    public Page<ScormInfo> findCourseInfoPageList(PageParameter pageParameter, ScormInfo scormInfo, int userId) {
        Page<ScormInfo> courseInfoPageList = scormDao.findCourseInfoPageList(pageParameter, scormInfo, userId);
        for (ScormInfo courseInfoPage : courseInfoPageList.getResultList()) {
            courseInfoPage.setShowCourseType(dictService.changeDictCodeToValue(courseInfoPage.getCourseType(), DictConstant.COURSE_TYPE));
                }
        return courseInfoPageList;
    }

    @Override
    public void delCourseInfo(String scormIds[]) {
        for (String scormId : scormIds) {
            scormDao.delCourseInfo(Integer.parseInt(scormId));
        }
    }
}
